package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.factorydata.mapper.ProcessMaterialRelationMapper;
import com.ruoyi.factorydata.domain.ProcessMaterialRelation;
import com.ruoyi.factorydata.service.IProcessMaterialRelationService;

/**
 * 工序物料关联Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-12
 */
@Service
public class ProcessMaterialRelationServiceImpl extends ServiceImpl<ProcessMaterialRelationMapper, ProcessMaterialRelation> implements IProcessMaterialRelationService {
    @Autowired
    private ProcessMaterialRelationMapper processMaterialRelationMapper;

    /**
     * 查询工序物料关联
     *
     * @param id 工序物料关联主键
     * @return 工序物料关联
     */
    @Override
    public ProcessMaterialRelation selectProcessMaterialRelationById(Long id) {
        return processMaterialRelationMapper.selectProcessMaterialRelationById(id);
    }

    /**
     * 查询工序物料关联列表
     *
     * @param processMaterialRelation 工序物料关联
     * @return 工序物料关联
     */
    @Override
    public List<ProcessMaterialRelation> selectProcessMaterialRelationList(ProcessMaterialRelation processMaterialRelation) {
        return processMaterialRelationMapper.selectProcessMaterialRelationList(processMaterialRelation);
    }

    /**
     * 新增工序物料关联
     *
     * @param processMaterialRelation 工序物料关联
     * @return 结果
     */
    @Override
    public int insertProcessMaterialRelation(ProcessMaterialRelation processMaterialRelation) {
                processMaterialRelation.setCreateTime(DateUtils.getNowDate());
            return processMaterialRelationMapper.insertProcessMaterialRelation(processMaterialRelation);
    }

    /**
     * 修改工序物料关联
     *
     * @param processMaterialRelation 工序物料关联
     * @return 结果
     */
    @Override
    public int updateProcessMaterialRelation(ProcessMaterialRelation processMaterialRelation) {
                processMaterialRelation.setUpdateTime(DateUtils.getNowDate());
        return processMaterialRelationMapper.updateProcessMaterialRelation(processMaterialRelation);
    }

    /**
     * 批量删除工序物料关联
     *
     * @param ids 需要删除的工序物料关联主键
     * @return 结果
     */
    @Override
    public int deleteProcessMaterialRelationByIds(Long[] ids) {
        return processMaterialRelationMapper.deleteProcessMaterialRelationByIds(ids);
    }

    /**
     * 删除工序物料关联信息
     *
     * @param id 工序物料关联主键
     * @return 结果
     */
    @Override
    public int deleteProcessMaterialRelationById(Long id) {
        return processMaterialRelationMapper.deleteProcessMaterialRelationById(id);
    }
}